console.log('Hello ! This is DiManager Extention !');

chrome.contextMenus.create({
    id: 'DiManagerMenuID',
    title: "选择图片作为桌面壁纸",
    contexts: ['page'],
    onclick: function (event, tab) {
        console.log('OK: ', event.srcUrl)
        console.log('Tab: ', tab)

        // chrome.tabs.create({url: 'DiImageDownloader://index?img=' + encodeURI(event.srcUrl)});
        chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
            chrome.tabs.sendMessage(tabs[0].id, 'MsgShowImages', function (response) {
                console.log('Response: ', response)
            });
        });
    }
});
